package createModel.BuilderModel.directorBuildPlayer;

import lombok.Data;

/***
 * 指挥者, 指挥调度流程: 建造的属性
 */
public class Director {

    AbstractBuild build;

    public void setBuild(AbstractBuild build) {
        this.build = build;
    }

    /**
     * 功能描述:指定建造的过程
     *
     * @return {@link Product }
     */
    public Product getProduct() {
        build.buildPartA("地基11");
        build.buildPartB("地基2");
        build.buildPartC("地基3");
        build.buildPartD("地基4");
        return build.getProduct();
    }

    public Product User2Product(User user){
        build.buildPartA(user.getUserName());
        build.buildPartB(user.getPassword());
        return build.getProduct();
    }

    public Product Department2Product(Department department){
        build.buildPartA(department.getDepartmentName());
        build.buildPartB(department.getDepartmentCode());
        return build.getProduct();
    }

    @Data
    public static class User{
        private String userName;
        private String password;
    }

    @Data
    public static class Department{
        private String departmentName;
        private String departmentCode;
    }
}
